#include <stdio.h>
#include <stdlib.h>
#define  N  5
double fun(int a[][N]);

main ( )
{  int a[N][N]={0,1,2,7,9,1,9,7,4,5,2,3,8,3,1,4,5,6,8,2,5,9,1,4,1};
   int i, j;
   double s ;
   printf("***** The array *****\n");
   for ( i =0;  i<N; i++ )
   {  for ( j =0; j<N; j++ )
     {  printf( "%4d", a[i][j] ); }
        printf("\n");
   }
   s=fun(a);
   printf ("***** THE  RESULT *****\n");
   printf( "The sum is :  %lf\n",s );
   }

double fun(int a[][N])
//ÇëÔÚÏÂÃæÌîÈë´úÂë£¬²»Òª¸Ä¶¯ÉÏÃæµÄ³ÌÐò
{
	int i=0,j=0;
	double s=0,b;
	for(i=0;i<N;i++){s=s+a[0][i];j++;}
	for(i=1;i<N-1;i++){s=s+a[i][0];j++;}
	for(i=1;i<N-1;i++){s=s+a[i][N-1];j++;}
	for(i=0;i<N;i++){s=s+a[N-1][i];j++;}
	b=s/j;
	return b;
}
